/**
 * @author Simon Richardson - simon@ustwo.co.uk
 */
package org.osflash.signals;

import asunit.asserts.AssertEquals;
import asunit.asserts.AssertTrue;
import asunit.framework.IAsync;

class MonoSignalDispatchExtraArgsTest {

	@:meta(Inject())
	public var async : IAsync;
	public var completed : MonoSignal;
	@:meta(Before())
	public function setUp() : Void {
		completed = new MonoSignal();
	}

	@:meta(After())
	public function tearDown() : Void {
		completed.removeAll();
		completed = null;
	}

	//////
	@:meta(Test())
	public function dispatch_extra_args_should_call_listener_with_extra_args() : Void {
		completed.add(async.add(onCompleted, 10));
		completed.dispatch(22, "done", new Date());
	}

	function onCompleted(a : UInt, b : String, c : Date) : Void {
		assertEquals(3, arguments.length);
		assertEquals(22, a);
		assertEquals("done", b);
		assertTrue(Std.is(c, Date));
	}

}

